using System;
using System.Collections.Generic;
using System.Text;

using OOFluidFramework.Utility;

namespace OOFluidFramework.Operators
{
    class EulerianOperatorImpl : FluidOperatorImpl, EulerianOperator
    {
      //EulerianOperator is a fixed speculator observing certain quantity
      //In this context, the quantity is speed
      //You can choose pick out X-Speed or Y-Speed by such a speculator
      //the boolean "isXDirection" marks this operator is for x - direction speed or y - direction
        bool isXDirection;
      public EulerianOperatorImpl(Vector2 InitialLocation, FluidSpaceOperatorRefere spaceRefere, bool isXDirection) 
          : base (InitialLocation,spaceRefere)
      { this.isXDirection = isXDirection; }
        public double Speed {
        get {
            if (isXDirection) return val.x;
            else return val.y;
        }
          set{
              preval = val;
              if (isXDirection) val.x = value;
              else val.y = value;
          }
        }  
        public double preSpeed{
            get{
                if (isXDirection) return preval.x;
                else return preval.y;
            }
        }
        public bool SpeculateMode
        {
            get { return isXDirection; }
            set { isXDirection = value; }
        }
       
    }

    interface EulerianOperator : FluidOperator
    {
        double Speed{
            get;
            set;
        }
        double preSpeed
        {
            get;
        }
        bool SpeculateMode
        {
            get;
            set;
        }
    }
}
